<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"yoursite.com","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":"flat"},"back2top":{"enable":true,"sidebar":true,"scrollpercent":true},"bookmark":{"enable":true,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="vscode 插件JavaScript Snippet Pack for Visual Studio Code Download this extension from the Visual Studio Code Marketplace  A snippet pack to make you more productive working with JavaScript. Based on Vi">
<meta property="og:type" content="article">
<meta property="og:title" content="软件&#x2F;VScode插件">
<meta property="og:url" content="http://yoursite.com/2020/06/08/%E8%BD%AF%E4%BB%B6/VScode%E6%8F%92%E4%BB%B6/index.html">
<meta property="og:site_name" content="heweiliang blog">
<meta property="og:description" content="vscode 插件JavaScript Snippet Pack for Visual Studio Code Download this extension from the Visual Studio Code Marketplace  A snippet pack to make you more productive working with JavaScript. Based on Vi">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-06-08T08:24:05.312Z">
<meta property="article:modified_time" content="2020-06-26T07:26:08.969Z">
<meta property="article:author" content="heweiliang">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://yoursite.com/2020/06/08/%E8%BD%AF%E4%BB%B6/VScode%E6%8F%92%E4%BB%B6/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>软件/VScode插件 | heweiliang blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="heweiliang blog" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">heweiliang blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-schedule">

    <a href="/schedule/" rel="section"><i class="fa fa-fw fa-calendar"></i>日程表</a>

  </li>
        <li class="menu-item menu-item-sitemap">

    <a href="/sitemap.xml" rel="section"><i class="fa fa-fw fa-sitemap"></i>站点地图</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="reading-progress-bar"></div>
  <a role="button" class="book-mark-link book-mark-link-fixed"></a>

  <a href="https://github.com/yourname" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2020/06/08/%E8%BD%AF%E4%BB%B6/VScode%E6%8F%92%E4%BB%B6/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="heweiliang">
      <meta itemprop="description" content="heweiliang blog">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="heweiliang blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          软件/VScode插件<a href="https://github.com/user-name/repo-name/tree/branch-name/subdirectory-name_posts/%E8%BD%AF%E4%BB%B6/VScode%E6%8F%92%E4%BB%B6.md" class="post-edit-link" title="编辑" rel="noopener" target="_blank"><i class="fa fa-pencil"></i></a>
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-06-08 16:24:05" itemprop="dateCreated datePublished" datetime="2020-06-08T16:24:05+08:00">2020-06-08</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-06-26 15:26:08" itemprop="dateModified" datetime="2020-06-26T15:26:08+08:00">2020-06-26</time>
              </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span><br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="fa fa-file-word-o"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>3.8k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="fa fa-clock-o"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>3 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="vscode-插件"><a href="#vscode-插件" class="headerlink" title="vscode 插件"></a>vscode 插件</h2><p>JavaScript Snippet Pack for Visual Studio Code</p>
<p>Download this extension from the <a href="https://marketplace.visualstudio.com/items/akamud.vscode-javascript-snippet-pack" target="_blank" rel="noopener">Visual Studio Code Marketplace</a></p>
<hr>
<p>A snippet pack to make you more productive working with JavaScript. Based on <a href="https://github.com/madskristensen/JavaScriptSnippetPack" target="_blank" rel="noopener">Visual Studio extension</a> by <a href="https://github.com/madskristensen" target="_blank" rel="noopener">Mads Kristensen</a>, which is based on <a href="https://atom.io/packages/javascript-snippets" target="_blank" rel="noopener">Atom snippets</a>.</p>
<p>This extension ships a bunch of useful code snippets for the JavaScript and TypeScript editors.</p>
<p>Here’s the full list of all the snippets:</p>
<h2 id="Console"><a href="#Console" class="headerlink" title="Console"></a>Console</h2><h3 id="cd-console-dir"><a href="#cd-console-dir" class="headerlink" title="[cd] console.dir"></a>[cd] console.dir</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">console.dir($&#123;1&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="ce-console-error"><a href="#ce-console-error" class="headerlink" title="[ce] console.error"></a>[ce] console.error</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">console.error($&#123;1&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="ci-console-info"><a href="#ci-console-info" class="headerlink" title="[ci] console.info"></a>[ci] console.info</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">console.info($&#123;1&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="cl-console-log"><a href="#cl-console-log" class="headerlink" title="[cl] console.log"></a>[cl] console.log</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">console.log($&#123;1&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="cw-console-warn"><a href="#cw-console-warn" class="headerlink" title="[cw] console.warn"></a>[cw] console.warn</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">console.warn($&#123;1&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="de-debugger"><a href="#de-debugger" class="headerlink" title="[de] debugger"></a>[de] debugger</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">debugger;</span><br></pre></td></tr></table></figure>

<h2 id="DOM"><a href="#DOM" class="headerlink" title="DOM"></a>DOM</h2><h3 id="ae-addEventListener"><a href="#ae-addEventListener" class="headerlink" title="[ae] addEventListener"></a>[ae] addEventListener</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.addEventListener(&#39;$&#123;2:load&#125;&#39;, function(e) &#123;    $&#123;3:&#x2F;&#x2F; body&#125;&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="ac-appendChild"><a href="#ac-appendChild" class="headerlink" title="[ac] appendChild"></a>[ac] appendChild</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.appendChild($&#123;2:elem&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="rc-removeChild"><a href="#rc-removeChild" class="headerlink" title="[rc] removeChild"></a>[rc] removeChild</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.removeChild($&#123;2:elem&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="cel-createElement"><a href="#cel-createElement" class="headerlink" title="[cel] createElement"></a>[cel] createElement</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.createElement($&#123;2:elem&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="cdf-createDocumentFragment"><a href="#cdf-createDocumentFragment" class="headerlink" title="[cdf] createDocumentFragment"></a>[cdf] createDocumentFragment</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.createDocumentFragment();</span><br></pre></td></tr></table></figure>

<h3 id="ca-classList-add"><a href="#ca-classList-add" class="headerlink" title="[ca] classList.add"></a>[ca] classList.add</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.classList.add(&#39;$&#123;2:class&#125;&#39;);</span><br></pre></td></tr></table></figure>

<h3 id="ct-classList-toggle"><a href="#ct-classList-toggle" class="headerlink" title="[ct] classList.toggle"></a>[ct] classList.toggle</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.classList.toggle(&#39;$&#123;2:class&#125;&#39;);</span><br></pre></td></tr></table></figure>

<h3 id="cr-classList-remove"><a href="#cr-classList-remove" class="headerlink" title="[cr] classList.remove"></a>[cr] classList.remove</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.classList.remove(&#39;$&#123;2:class&#125;&#39;);</span><br></pre></td></tr></table></figure>

<h3 id="gi-getElementById"><a href="#gi-getElementById" class="headerlink" title="[gi] getElementById"></a>[gi] getElementById</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.getElementById(&#39;$&#123;2:id&#125;&#39;);</span><br></pre></td></tr></table></figure>

<h3 id="gc-getElementsByClassName"><a href="#gc-getElementsByClassName" class="headerlink" title="[gc] getElementsByClassName"></a>[gc] getElementsByClassName</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.getElementsByClassName(&#39;$&#123;2:class&#125;&#39;);</span><br></pre></td></tr></table></figure>

<h3 id="gt-getElementsByTagName"><a href="#gt-getElementsByTagName" class="headerlink" title="[gt] getElementsByTagName"></a>[gt] getElementsByTagName</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.getElementsByTagName(&#39;$&#123;2:tag&#125;&#39;);</span><br></pre></td></tr></table></figure>

<h3 id="ga-getAttribute"><a href="#ga-getAttribute" class="headerlink" title="[ga] getAttribute"></a>[ga] getAttribute</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.getAttribute(&#39;$&#123;2:attr&#125;&#39;);</span><br></pre></td></tr></table></figure>

<h3 id="sa-setAttribute"><a href="#sa-setAttribute" class="headerlink" title="[sa] setAttribute"></a>[sa] setAttribute</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.setAttribute(&#39;$&#123;2:attr&#125;&#39;, $&#123;3:value&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="ra-removeAttribute"><a href="#ra-removeAttribute" class="headerlink" title="[ra] removeAttribute"></a>[ra] removeAttribute</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.removeAttribute(&#39;$&#123;2:attr&#125;&#39;);</span><br></pre></td></tr></table></figure>

<h3 id="ih-innerHTML"><a href="#ih-innerHTML" class="headerlink" title="[ih] innerHTML"></a>[ih] innerHTML</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.innerHTML &#x3D; &#39;$&#123;2:elem&#125;&#39;;</span><br></pre></td></tr></table></figure>

<h3 id="tc-textContent"><a href="#tc-textContent" class="headerlink" title="[tc] textContent"></a>[tc] textContent</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.textContent &#x3D; &#39;$&#123;2:content&#125;&#39;;</span><br></pre></td></tr></table></figure>

<h3 id="qs-querySelector"><a href="#qs-querySelector" class="headerlink" title="[qs] querySelector"></a>[qs] querySelector</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.querySelector(&#39;$&#123;2:selector&#125;&#39;);</span><br></pre></td></tr></table></figure>

<h3 id="qsa-querySelectorAll"><a href="#qsa-querySelectorAll" class="headerlink" title="[qsa] querySelectorAll"></a>[qsa] querySelectorAll</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:document&#125;.querySelectorAll(&#39;$&#123;2:selector&#125;&#39;);</span><br></pre></td></tr></table></figure>

<h2 id="Loop"><a href="#Loop" class="headerlink" title="Loop"></a>Loop</h2><h3 id="fe-forEach"><a href="#fe-forEach" class="headerlink" title="[fe] forEach"></a>[fe] forEach</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:array&#125;.forEach(function(item) &#123;    $&#123;2:&#x2F;&#x2F; body&#125;&#125;);</span><br></pre></td></tr></table></figure>

<h2 id="Function"><a href="#Function" class="headerlink" title="Function"></a>Function</h2><h3 id="fn-function"><a href="#fn-function" class="headerlink" title="[fn] function"></a>[fn] function</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">function $&#123;1:methodName&#125; ($&#123;2:arguments&#125;) &#123;    $&#123;3:&#x2F;&#x2F; body&#125;&#125;</span><br></pre></td></tr></table></figure>

<h3 id="afn-anonymous-function"><a href="#afn-anonymous-function" class="headerlink" title="[afn] anonymous function"></a>[afn] anonymous function</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">function($&#123;1:arguments&#125;) &#123;    $&#123;2:&#x2F;&#x2F; body&#125;&#125;</span><br></pre></td></tr></table></figure>

<h3 id="pr-prototype"><a href="#pr-prototype" class="headerlink" title="[pr] prototype"></a>[pr] prototype</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:object&#125;.prototype.$&#123;2:method&#125; &#x3D; function($&#123;3:arguments&#125;) &#123;    $&#123;4:&#x2F;&#x2F; body&#125;&#125;</span><br></pre></td></tr></table></figure>

<h3 id="iife-immediately-invoked-function-expression"><a href="#iife-immediately-invoked-function-expression" class="headerlink" title="[iife] immediately-invoked function expression"></a>[iife] immediately-invoked function expression</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">(function($&#123;1:window&#125;, $&#123;2:document&#125;) &#123;    $&#123;3:&#x2F;&#x2F; body&#125;&#125;)($&#123;1:window&#125;, $&#123;2:document&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="call-function-call"><a href="#call-function-call" class="headerlink" title="[call] function call"></a>[call] function call</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:method&#125;.call($&#123;2:context&#125;, $&#123;3:arguments&#125;)</span><br></pre></td></tr></table></figure>

<h3 id="apply-function-apply"><a href="#apply-function-apply" class="headerlink" title="[apply] function apply"></a>[apply] function apply</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:method&#125;.apply($&#123;2:context&#125;, [$&#123;3:arguments&#125;])</span><br></pre></td></tr></table></figure>

<h3 id="ofn-function-as-a-property-of-an-object"><a href="#ofn-function-as-a-property-of-an-object" class="headerlink" title="[ofn] function as a property of an object"></a>[ofn] function as a property of an object</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$&#123;1:functionName&#125;: function($&#123;2:arguments&#125;) &#123;    $&#123;3:&#x2F;&#x2F; body&#125;&#125;</span><br></pre></td></tr></table></figure>

<h2 id="JSON"><a href="#JSON" class="headerlink" title="JSON"></a>JSON</h2><h3 id="jp-JSON-parse"><a href="#jp-JSON-parse" class="headerlink" title="[jp] JSON.parse"></a>[jp] JSON.parse</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">JSON.parse($&#123;1:obj&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="js-JSON-stringify"><a href="#js-JSON-stringify" class="headerlink" title="[js] JSON.stringify"></a>[js] JSON.stringify</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">JSON.stringify($&#123;1:obj&#125;);</span><br></pre></td></tr></table></figure>

<h2 id="Timer"><a href="#Timer" class="headerlink" title="Timer"></a>Timer</h2><h3 id="si-setInterval"><a href="#si-setInterval" class="headerlink" title="[si] setInterval"></a>[si] setInterval</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">setInterval(function() &#123;    $&#123;0:&#x2F;&#x2F; body&#125;&#125;, $&#123;1:1000&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="st-setTimeout"><a href="#st-setTimeout" class="headerlink" title="[st] setTimeout"></a>[st] setTimeout</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">setTimeout(function() &#123;    $&#123;0:&#x2F;&#x2F; body&#125;&#125;, $&#123;1:1000&#125;);</span><br></pre></td></tr></table></figure>

<h2 id="Misc"><a href="#Misc" class="headerlink" title="Misc"></a>Misc</h2><h3 id="us-use-strict"><a href="#us-use-strict" class="headerlink" title="[us] use strict"></a>[us] use strict</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&#39;use strict&#39;;</span><br></pre></td></tr></table></figure>

<h3 id="al-alert"><a href="#al-alert" class="headerlink" title="[al] alert"></a>[al] alert</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">alert(&#39;$&#123;1:msg&#125;&#39;);</span><br></pre></td></tr></table></figure>

<h3 id="co-confirm"><a href="#co-confirm" class="headerlink" title="[co] confirm"></a>[co] confirm</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">confirm(&#39;$&#123;1:msg&#125;&#39;);</span><br></pre></td></tr></table></figure>

<h3 id="pm-prompt"><a href="#pm-prompt" class="headerlink" title="[pm] prompt"></a>[pm] prompt</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">prompt(&#39;$&#123;1:msg&#125;&#39;);</span><br></pre></td></tr></table></figure>


    </div>

    
    
    
        <div class="reward-container">
  <div></div>
  <button onclick="var qr = document.getElementById('qr'); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">
      
      <div style="display: inline-block;">
        <img src="/images/wechatpay.jpg" alt="heweiliang 微信支付">
        <p>微信支付</p>
      </div>
      
      <div style="display: inline-block;">
        <img src="/images/alipay.jpg" alt="heweiliang 支付宝">
        <p>支付宝</p>
      </div>

  </div>
</div>

        

  <div class="followme">
    <p>欢迎关注我的其它发布渠道</p>

    <div class="social-list">

        <div class="social-item">
          <a target="_blank" class="social-link" href="/atom.xml">
            <span class="icon">
              <i class="fa fa-rss"></i>
            </span>

            <span class="label">RSS</span>
          </a>
        </div>
    </div>
  </div>


      <footer class="post-footer">

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/06/07/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9B%BE%E5%BD%A2%E5%AD%A6/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9B%BE%E5%BD%A2%E5%AD%A6/" rel="prev" title="计算机基础/计算机图形学/计算机图形学">
      <i class="fa fa-chevron-left"></i> 计算机基础/计算机图形学/计算机图形学
    </a></div>
      <div class="post-nav-item">
    <a href="/2020/06/11/%E5%89%8D%E7%AB%AF/%E7%BD%91%E9%A1%B5%E6%95%88%E6%9E%9C/%E6%BB%9A%E5%8A%A8%E8%A7%86%E5%B7%AE/" rel="next" title="前端/网页效果/滚动视差">
      前端/网页效果/滚动视差 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    
  <div class="comments">
    <div id="lv-container" data-id="city" data-uid="MTAyMC81MDY1MC8yNzEzMw=="></div>
  </div>
  

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#vscode-插件"><span class="nav-number">1.</span> <span class="nav-text">vscode 插件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Console"><span class="nav-number">2.</span> <span class="nav-text">Console</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#cd-console-dir"><span class="nav-number">2.1.</span> <span class="nav-text">[cd] console.dir</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ce-console-error"><span class="nav-number">2.2.</span> <span class="nav-text">[ce] console.error</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ci-console-info"><span class="nav-number">2.3.</span> <span class="nav-text">[ci] console.info</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#cl-console-log"><span class="nav-number">2.4.</span> <span class="nav-text">[cl] console.log</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#cw-console-warn"><span class="nav-number">2.5.</span> <span class="nav-text">[cw] console.warn</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#de-debugger"><span class="nav-number">2.6.</span> <span class="nav-text">[de] debugger</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#DOM"><span class="nav-number">3.</span> <span class="nav-text">DOM</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#ae-addEventListener"><span class="nav-number">3.1.</span> <span class="nav-text">[ae] addEventListener</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ac-appendChild"><span class="nav-number">3.2.</span> <span class="nav-text">[ac] appendChild</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#rc-removeChild"><span class="nav-number">3.3.</span> <span class="nav-text">[rc] removeChild</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#cel-createElement"><span class="nav-number">3.4.</span> <span class="nav-text">[cel] createElement</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#cdf-createDocumentFragment"><span class="nav-number">3.5.</span> <span class="nav-text">[cdf] createDocumentFragment</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ca-classList-add"><span class="nav-number">3.6.</span> <span class="nav-text">[ca] classList.add</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ct-classList-toggle"><span class="nav-number">3.7.</span> <span class="nav-text">[ct] classList.toggle</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#cr-classList-remove"><span class="nav-number">3.8.</span> <span class="nav-text">[cr] classList.remove</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#gi-getElementById"><span class="nav-number">3.9.</span> <span class="nav-text">[gi] getElementById</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#gc-getElementsByClassName"><span class="nav-number">3.10.</span> <span class="nav-text">[gc] getElementsByClassName</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#gt-getElementsByTagName"><span class="nav-number">3.11.</span> <span class="nav-text">[gt] getElementsByTagName</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ga-getAttribute"><span class="nav-number">3.12.</span> <span class="nav-text">[ga] getAttribute</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#sa-setAttribute"><span class="nav-number">3.13.</span> <span class="nav-text">[sa] setAttribute</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ra-removeAttribute"><span class="nav-number">3.14.</span> <span class="nav-text">[ra] removeAttribute</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ih-innerHTML"><span class="nav-number">3.15.</span> <span class="nav-text">[ih] innerHTML</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#tc-textContent"><span class="nav-number">3.16.</span> <span class="nav-text">[tc] textContent</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#qs-querySelector"><span class="nav-number">3.17.</span> <span class="nav-text">[qs] querySelector</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#qsa-querySelectorAll"><span class="nav-number">3.18.</span> <span class="nav-text">[qsa] querySelectorAll</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Loop"><span class="nav-number">4.</span> <span class="nav-text">Loop</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#fe-forEach"><span class="nav-number">4.1.</span> <span class="nav-text">[fe] forEach</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Function"><span class="nav-number">5.</span> <span class="nav-text">Function</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#fn-function"><span class="nav-number">5.1.</span> <span class="nav-text">[fn] function</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#afn-anonymous-function"><span class="nav-number">5.2.</span> <span class="nav-text">[afn] anonymous function</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#pr-prototype"><span class="nav-number">5.3.</span> <span class="nav-text">[pr] prototype</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#iife-immediately-invoked-function-expression"><span class="nav-number">5.4.</span> <span class="nav-text">[iife] immediately-invoked function expression</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#call-function-call"><span class="nav-number">5.5.</span> <span class="nav-text">[call] function call</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#apply-function-apply"><span class="nav-number">5.6.</span> <span class="nav-text">[apply] function apply</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ofn-function-as-a-property-of-an-object"><span class="nav-number">5.7.</span> <span class="nav-text">[ofn] function as a property of an object</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#JSON"><span class="nav-number">6.</span> <span class="nav-text">JSON</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#jp-JSON-parse"><span class="nav-number">6.1.</span> <span class="nav-text">[jp] JSON.parse</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#js-JSON-stringify"><span class="nav-number">6.2.</span> <span class="nav-text">[js] JSON.stringify</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Timer"><span class="nav-number">7.</span> <span class="nav-text">Timer</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#si-setInterval"><span class="nav-number">7.1.</span> <span class="nav-text">[si] setInterval</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#st-setTimeout"><span class="nav-number">7.2.</span> <span class="nav-text">[st] setTimeout</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Misc"><span class="nav-number">8.</span> <span class="nav-text">Misc</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#us-use-strict"><span class="nav-number">8.1.</span> <span class="nav-text">[us] use strict</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#al-alert"><span class="nav-number">8.2.</span> <span class="nav-text">[al] alert</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#co-confirm"><span class="nav-number">8.3.</span> <span class="nav-text">[co] confirm</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#pm-prompt"><span class="nav-number">8.4.</span> <span class="nav-text">[pm] prompt</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="heweiliang"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">heweiliang</p>
  <div class="site-description" itemprop="description">heweiliang blog</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">96</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">18</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">24</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/yourname" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;yourname" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i></a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:yourname@gmail.com" title="E-Mail → mailto:yourname@gmail.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i></a>
      </span>
      <span class="links-of-author-item">
        <a href="https://plus.google.com/yourname" title="Google → https:&#x2F;&#x2F;plus.google.com&#x2F;yourname" rel="noopener" target="_blank"><i class="fa fa-fw fa-google"></i></a>
      </span>
      <span class="links-of-author-item">
        <a href="https://stackoverflow.com/yourname" title="StackOverflow → https:&#x2F;&#x2F;stackoverflow.com&#x2F;yourname" rel="noopener" target="_blank"><i class="fa fa-fw fa-stack-overflow"></i></a>
      </span>
  </div>
  <div class="cc-license motion-element" itemprop="license">
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title">
      <i class="fa fa-fw fa-link"></i>
      Links
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="http://yoursite.com/" title="http:&#x2F;&#x2F;yoursite.com">Title</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="http://yoursite.com/" title="http:&#x2F;&#x2F;yoursite.com">Title2</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="http://yoursite.com/" title="http:&#x2F;&#x2F;yoursite.com">Title3</a>
        </li>
    </ul>
  </div>

      </div>
        <div class="back-to-top motion-element">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">heweiliang</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    <span title="站点总字数">376k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">5:42</span>
</div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>

<script src="/js/bookmark.js"></script>


  <script defer src="/lib/three/three.min.js"></script>
    <script defer src="/lib/three/three-waves.min.js"></script>
    <script defer src="/lib/three/canvas_lines.min.js"></script>


  




  
<script src="/js/local-search.js"></script>













  

  

<script>
NexT.utils.loadComments(document.querySelector('#lv-container'), () => {
  window.livereOptions = {
    refer: location.pathname.replace(CONFIG.root, '').replace('index.html', '')
  };
  (function(d, s) {
    var j, e = d.getElementsByTagName(s)[0];
    if (typeof LivereTower === 'function') { return; }
    j = d.createElement(s);
    j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
    j.async = true;
    e.parentNode.insertBefore(j, e);
  })(document, 'script');
});
</script>

<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginModelPath":"assets/","model":{"jsonPath":"/live2dw/assets/Epsilon2.1.model.json"},"display":{"position":"left","width":300,"height":600},"mobile":{"show":false},"log":false,"pluginJsPath":"lib/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
